﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using log4net.Core;

namespace Aribaccio.Logger
{
    public class LoggerMsg
    {
        /// <summary>
        /// 消息内容
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 消息等级
        /// </summary>
        public Level MsgLevel { get; set; }
        /// <summary>
        /// 消息时间
        /// </summary>
        public DateTime MsgDateTime { get; set; }
        /// <summary>
        /// 消息日期时间格式
        /// </summary>
        public string MsgDateTimeFormat { get; set; }
        /// <summary>
        /// 异常消息
        /// </summary>
        public Exception? MsgException { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public LoggerMsg()
        {
            this.Message = string.Empty;
            this.MsgLevel = Level.Info;
            this.MsgDateTime = DateTime.Now;
            this.MsgDateTimeFormat = "HH:mm:ss.fff";
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public LoggerMsg(string argMessage, Level argLevel)
            : this()
        {
            this.Message = argMessage;
            this.MsgLevel = argLevel;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public LoggerMsg(string argMessage, Level argLevel, Exception? argException)
            : this(argMessage, argLevel)
        {
            this.MsgException = argException;
        }
    }
}
